create table harvestAddress(
       harve_Id number(5) primary key,              --�ջ��ַid
       member_Id number(5),                         --��ԱID
       harve_People varchar(20),                    --�ջ���
       harve_Region varchar(200),                   --���ڵ���
       harve_Address varchar(200),                  --��ϸ��ַ
       harve_ZipCode varchar(50),                   --�ʱ�
       harve_Phone varchar(50),                     --�ֻ���
       harve_whetherOrNot number(1)                  --�Ƿ�Ĭ�ϣ�0�ǣ�1��
)

/*���ﳵ*/
create table shoppingCart(
       cart_Id number(5) primary key,                --���ﳵId
       member_Id number(5),                          --��ԱId
       cart_total number(8)                          --��Ʒ��������
)

/*���ﳵ��Ʒ������*/
create table associationTable(
       table_Id number(5) primary key,               --��Ʒ������ID
       cart_Id number(5),                            --���ﳵId
       comm number(5),                               --��ƷId
       table_amount number(5)                        --��Ʒ����
)



/*�ջ��ַid����*/
create sequence Sequence_harvestAddress1
       start with 1                                  --��1��ʼ����
       INCREMENT BY 1                                --ÿ�μ�һλ��
       NOMAXvalue                                    --���������ֵ
       NOCYCLE                                   --ֱ�ۼӣ���ѭ��
       
/*���ﳵid����*/
create sequence Sequence_shoppingCart1
       start with 1                                  --��1��ʼ����
       INCREMENT BY 1                                --ÿ�μ�һλ��
       NOMAXvalue                                    --���������ֵ
       NOCYCLE                                    --ֱ�ۼӣ���ѭ��
       
/*���ﳵ��Ʒ������*/
create sequence Sequence_associationTable1
        start with 1                                  --��1��ʼ����
       INCREMENT BY 1                                --ÿ�μ�һλ��
       NOMAXvalue                                    --���������ֵ
       NOCYCLE                                    --ֱ�ۼӣ���ѭ��
/*����ջ���Ϣ*/
select * from harvestAddress                  --�ջ���ѯ
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1001,'����','����ʡ�Ϸ�����ɽ��','÷ɽ·107����ɽ��������¥0512��','230031','13112345678',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1002,'����','����ʡ�Ϸ���®����','������·�ж�360��','236000','13312345678',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1003,'����','����ʡ������','����������������Ķ����й��ƶ�','230001','13114725836',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1004,'����С','����ʡ�Ϸ���������','������ó��K��K5-3C1008��','230011','13114725835',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1005,'��С��','����ʡ�Ϸ��з�����','��ɽ·���⹺�����Ķ������ѧУ','231200','13114725838',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1006,'����','����ʡ�Ϸ��зʶ���','�ϵ�·��һ�����ƺ���','231600','13114725831',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1007,'Ǯ��','����ʡ�Ϸ��г�����','ׯĹ������Ļ�����ѧУ(�ϻ�·)','231100','13114725833',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1008,'����','����ʡ�Ϸ��а�����','���Ӵ��������·����ڰٴ����ó�','230041','13114725837',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1009,'������','����ʡ�Ϸ���������','����·11�źϷ���֮�����޹�˾','230000,','13114725834',0);
insert into harvestAddress values(Sequence_harvestAddress1.Nextval,1010,'����','����ʡ�����������','�������й�Ԣ(�����·��60��)','236000','13114725839',0);

/*���ﳵ������*/
select * from shoppingCart                         --���ﳵ�����ݲ�ѯ
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1001,1);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1002,2);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1003,3);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1004,1);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1005,1);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1006,2);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1007,1);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1008,5);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1009,1);
insert into shoppingCart values(Sequence_shoppingCart1.Nextval,1010,1);

/*���ﳵ��Ʒ����������*/
insert into associationTable values();



select * from e_user                               --��ѯ��Ա��
select * from harvestAddress                       --��ѯ�ջ��ַ
select * from orders                                --��ѯ�û�������

--�����ѯ
select 
e.u_id,e.u_account,e.u_nickname,e.u_gender,e.u_phonenumber,e.u_email,e.u_address,e.u_integral,e.u_regdate
,h.harve_id,h.harve_region,h.harve_address,o.orders_id,o.orders_price,o.orders_state,o.orders_address,o.orders_remarks,o.orders_date
from e_user e,orders o,harvestAddress h where e.u_id=h.member_id and e.u_id=o.consumer_id(+)

--������Ա���ջ��ַ������������ͼ
create or replace view View_UserHarvestOrders
as
select 
e.u_id,e.u_account,e.u_nickname,e.u_gender,e.u_phonenumber,e.u_email,e.u_address,e.u_integral,e.u_regdate
,h.harve_id,h.harve_region,h.harve_address,o.orders_id,o.orders_price,o.WARE_ID,o.orders_state,o.orders_address,o.orders_remarks,o.orders_date
from e_user e,orders o,harvestAddress h where e.u_id=h.member_id and e.u_id=o.consumer_id(+)

select * from View_UserHarvestOrders


